<template>
    <el-container class="container">
        <el-header class="header">
            
            <!-- <div>
                <el-dropdown @command="downEvent">
                    <span class="el-dropdown-link">
                        欢迎{{$store.state.userModules.user.username}}登录<i
                            class="el-icon-arrow-down el-icon--right"
                        ></i>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="logout">注销</el-dropdown-item>
                        <el-dropdown-item command="update">修改密码</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </div> -->
        </el-header>
        <el-container>
            <el-aside width="200px">
                <Nav></Nav>
            </el-aside>
            <el-container>
                <el-main style="text-align:left">
                  <!-- 二级路由渲染 -->
                  <router-view/>
                </el-main>
                <el-footer>Footer</el-footer>
            </el-container>
        </el-container>
    </el-container>
</template>

<script>
import Nav from "../components/Nav.vue"
export default {
  components:{
    Nav
  },
  methods:{
    downEvent(val){
      console.log(val);
      if(val=="logout"){
        localStorage.removeItem("token")
        this.$router.replace("/login")
      }else{
        this.$message({
          type:"warning",
          message:"该功能暂未开放"
        })
      }
    }
  }
};
</script>

<style scoped lang="scss">
.container {
    height: 100%;
}
.header {
    display: flex;
    justify-content: space-between;
    .logo {
        img {
            width: 180px;
            margin-top: 10px;
        }
    }
}
.el-header,
.el-footer {
    background-color: #2d3a4b;
    color: #333;
    text-align: center;
    line-height: 60px;
}

.el-aside {
    background-color: #d3dce6;
    color: #333;
    text-align: center;
    line-height: 200px;
}

.el-main {
    background-color: #e9eef3;
    color: #333;
    text-align: center;
    // line-height: 160px;
}

body > .el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
}
.el-dropdown-link {
    cursor: pointer;
    color: #409eff;
}
.el-icon-arrow-down {
    font-size: 12px;
}
</style>